package j2src;

import java.util.Vector;
import beans.ZipcodeDaoHome;
import beans.ZipcodeDaoRemote;


public class ZipcodeDaoDelegate {
	private ZipcodeDaoHome zipcodeDaoHome;
    private ZipcodeDaoRemote zipcodeDaoRemote;
    public ZipcodeDaoDelegate() throws Exception {
        initializeZipcodeDaoHome();
        zipcodeDaoRemote = zipcodeDaoHome.create();
    }
    public Vector getRequestZipcode(String city) throws Exception{
    	return zipcodeDaoRemote.getRequestZipcode(city);
    }
    
    private void initializeZipcodeDaoHome() throws Exception {
        String FACADE_NAME = "ZipcodeDaoBean";
        Class FACADE_CLASS = beans.ZipcodeDaoHome.class;
        if (zipcodeDaoHome == null) {
            try {
                WhiteDaoLocator locator = WhiteDaoLocator.getInstance();
                zipcodeDaoHome = (ZipcodeDaoHome)WhiteDaoLocator.getEjbHome(FACADE_NAME, FACADE_CLASS);
                if (zipcodeDaoHome == null) {
                    throw new Exception("Did not get home for " + FACADE_NAME);
                }
            } catch (WhiteDaoLocatorException e) {
                throw new Exception(e.getMessage());
            }
        }
    }
}
